package com.hjb.springbootdemo.thread;

import java.util.HashMap;

public class JoinTest extends Thread implements Runnable{
    public static void main(String[] args) throws InterruptedException {
        JoinTest joinTest = new JoinTest();
        Thread thread1 = new Thread(joinTest);
        thread1.start();
        thread1.join();
        System.out.println("我是主线程");

    }
    @Override
    public void run() {
        try {
            Thread.sleep(2000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("我是子线程");
    }
}
